Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Windows.Forms

Public Class FrmCrSLKH_NHIEU_THANG_TDV
    Private data As DataTable
    Private Tungay, Denngay As String
    Private customerReport As ReportDocument

    Private Sub FrmCrSLKH_NHIEU_THANG_TDV_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        frmLoading.Show()
        Dim sqlQuery As String = "SELECT t2.ngay_chungtu,t2.ma_khachhang,t2.ma_phu,t1.ten_nhacungcap FROM (tbl_xuat_hanghoa as t2 LEFT JOIN  tbl_khachhang as t1 ON t2.ma_khachhang=t1.ma_nhacungcap)  WHERE  t2.ngay_chungtu BETWEEN '" & Format(CDate(Tungay), "yyyy-MM-dd") & "' AND '" & Format(CDate(Denngay), "yyyy-MM-dd") & "' AND t2.loaixuat=0 AND t2.ma_khachhang like '%ZZ'  "
        Dim reportPath = Application.StartupPath & "\" & "crSLKH_NHIEU_THANG_TDV.rpt"
        customerReport = New ReportDocument()
        customerReport.Load(reportPath)
        customerReport.SetDataSource(moduleReportConfig.GetDataTable(sqlQuery))
        'customerReport.SetDataSource(data)
        customerReport.SetParameterValue("TTungay", Tungay)
        customerReport.SetParameterValue("TDenngay", Denngay)
        Me.CrNXTTongHopview.ReportSource = customerReport
        frmLoading.Close()
        frmLoading.Dispose()
    End Sub

    Private Sub BtnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Close()
    End Sub
    Public Sub setTungay(ByVal s As String)
        Tungay = s
    End Sub

    Public Sub setDenngay(ByVal s As String)
        Denngay = s
    End Sub

End Class
